Integrand size = 23, antiderivative size = 250 \[ \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=-\frac {a^2 (d \cot (e+f x))^{3+n}}{b \left (a^2+b^2\right ) d^3 f (b+a \cot (e+f x))}+\frac {\left (a^2-b^2\right ) (d \cot (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right )^2 d^3 f (3+n)}+\frac {a^2 \left (b^2 n+a^2 (2+n)\right ) (d \cot (e+f x))^{3+n} \operatorname {Hypergeometric2F1}\left (1,3+n,4+n,-\frac {a \cot (e+f x)}{b}\right )}{b^2 \left (a^2+b^2\right )^2 d^3 f (3+n)}+\frac {2 a b (d \cot (e+f x))^{4+n} \operatorname {Hypergeometric2F1}\left (1,\frac {4+n}{2},\frac {6+n}{2},-\cot ^2(e+f x)\right )}{\left (a^2+b^2\right )^2 d^4 f (4+n)} \]
-a^2*(d*cot(f*x+e))^(3+n)/b/(a^2+b^2)/d^3/f/(b+a*cot(f*x+e))+(a^2-b^2)*(d* cot(f*x+e))^(3+n)*hypergeom([1, 3/2+1/2*n],[5/2+1/2*n],-cot(f*x+e)^2)/(a^2 +b^2)^2/d^3/f/(3+n)+a^2*(b^2*n+a^2*(2+n))*(d*cot(f*x+e))^(3+n)*hypergeom([ 1, 3+n],[4+n],-a*cot(f*x+e)/b)/b^2/(a^2+b^2)^2/d^3/f/(3+n)+2*a*b*(d*cot(f* x+e))^(4+n)*hypergeom([1, 2+1/2*n],[3+1/2*n],-cot(f*x+e)^2)/(a^2+b^2)^2/d^ 4/f/(4+n)
Time = 0.89 (sec) , antiderivative size = 192, normalized size of antiderivative = 0.77 \[ \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=-\frac {\cot ^3(e+f x) (d \cot (e+f x))^n \left (b^2 \left (-a^2+b^2\right ) (4+n) \operatorname {Hypergeometric2F1}\left (1,\frac {3+n}{2},\frac {5+n}{2},-\cot ^2(e+f x)\right )+a \left (2 a b^2 (4+n) \operatorname {Hypergeometric2F1}\left (1,3+n,4+n,-\frac {a \cot (e+f x)}{b}\right )-2 b^3 (3+n) \cot (e+f x) \operatorname {Hypergeometric2F1}\left (1,\frac {4+n}{2},\frac {6+n}{2},-\cot ^2(e+f x)\right )+a \left (a^2+b^2\right ) (4+n) \operatorname {Hypergeometric2F1}\left (2,3+n,4+n,-\frac {a \cot (e+f x)}{b}\right )\right )\right )}{b^2 \left (a^2+b^2\right )^2 f (3+n) (4+n)} \]
-((Cot[e + f*x]^3*(d*Cot[e + f*x])^n*(b^2*(-a^2 + b^2)*(4 + n)*Hypergeomet ric2F1[1, (3 + n)/2, (5 + n)/2, -Cot[e + f*x]^2] + a*(2*a*b^2*(4 + n)*Hype rgeometric2F1[1, 3 + n, 4 + n, -((a*Cot[e + f*x])/b)] - 2*b^3*(3 + n)*Cot[ e + f*x]*Hypergeometric2F1[1, (4 + n)/2, (6 + n)/2, -Cot[e + f*x]^2] + a*( a^2 + b^2)*(4 + n)*Hypergeometric2F1[2, 3 + n, 4 + n, -((a*Cot[e + f*x])/b )])))/(b^2*(a^2 + b^2)^2*f*(3 + n)*(4 + n)))
Time = 1.67 (sec) , antiderivative size = 263, normalized size of antiderivative = 1.05, number of steps used = 16, number of rules used = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.652, Rules used = {3042, 4156, 3042, 4052, 25, 3042, 4136, 25, 3042, 4021, 3042, 3957, 278, 4117, 74}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2}dx\) |
\(\Big \downarrow \) 4156 |
\(\displaystyle \frac {\int \frac {(d \cot (e+f x))^{n+2}}{(b+a \cot (e+f x))^2}dx}{d^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {\left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2}}{\left (b-a \tan \left (e+f x+\frac {\pi }{2}\right )\right )^2}dx}{d^2}\) |
\(\Big \downarrow \) 4052 |
\(\displaystyle \frac {-\frac {\int -\frac {(d \cot (e+f x))^{n+2} \left (-a^2 d (n+2) \cot ^2(e+f x)-a b d \cot (e+f x)+d \left (b^2-a^2 (n+2)\right )\right )}{b+a \cot (e+f x)}dx}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {\frac {\int \frac {(d \cot (e+f x))^{n+2} \left (-a^2 d (n+2) \cot ^2(e+f x)-a b d \cot (e+f x)+d \left (b^2-a^2 (n+2)\right )\right )}{b+a \cot (e+f x)}dx}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {\int \frac {\left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2} \left (-a^2 d (n+2) \tan \left (e+f x+\frac {\pi }{2}\right )^2+a b d \tan \left (e+f x+\frac {\pi }{2}\right )+d \left (b^2-a^2 (n+2)\right )\right )}{b-a \tan \left (e+f x+\frac {\pi }{2}\right )}dx}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 4136 |
\(\displaystyle \frac {\frac {\frac {\int -(d \cot (e+f x))^{n+2} \left (2 a d \cot (e+f x) b^2+\left (a^2-b^2\right ) d b\right )dx}{a^2+b^2}-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {(d \cot (e+f x))^{n+2} \left (\cot ^2(e+f x)+1\right )}{b+a \cot (e+f x)}dx}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {\frac {-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {(d \cot (e+f x))^{n+2} \left (\cot ^2(e+f x)+1\right )}{b+a \cot (e+f x)}dx}{a^2+b^2}-\frac {\int (d \cot (e+f x))^{n+2} \left (2 a d \cot (e+f x) b^2+\left (a^2-b^2\right ) d b\right )dx}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {\left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2} \left (\tan \left (e+f x+\frac {\pi }{2}\right )^2+1\right )}{b-a \tan \left (e+f x+\frac {\pi }{2}\right )}dx}{a^2+b^2}-\frac {\int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2} \left (b \left (a^2-b^2\right ) d-2 a b^2 d \tan \left (e+f x+\frac {\pi }{2}\right )\right )dx}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 4021 |
\(\displaystyle \frac {\frac {-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {\left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2} \left (\tan \left (e+f x+\frac {\pi }{2}\right )^2+1\right )}{b-a \tan \left (e+f x+\frac {\pi }{2}\right )}dx}{a^2+b^2}-\frac {b d \left (a^2-b^2\right ) \int (d \cot (e+f x))^{n+2}dx+2 a b^2 \int (d \cot (e+f x))^{n+3}dx}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {\left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2} \left (\tan \left (e+f x+\frac {\pi }{2}\right )^2+1\right )}{b-a \tan \left (e+f x+\frac {\pi }{2}\right )}dx}{a^2+b^2}-\frac {b d \left (a^2-b^2\right ) \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2}dx+2 a b^2 \int \left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+3}dx}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 3957 |
\(\displaystyle \frac {\frac {-\frac {-\frac {b d^2 \left (a^2-b^2\right ) \int \frac {(d \cot (e+f x))^{n+2}}{\cot ^2(e+f x) d^2+d^2}d(d \cot (e+f x))}{f}-\frac {2 a b^2 d \int \frac {(d \cot (e+f x))^{n+3}}{\cot ^2(e+f x) d^2+d^2}d(d \cot (e+f x))}{f}}{a^2+b^2}-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {\left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2} \left (\tan \left (e+f x+\frac {\pi }{2}\right )^2+1\right )}{b-a \tan \left (e+f x+\frac {\pi }{2}\right )}dx}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 278 |
\(\displaystyle \frac {\frac {-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {\left (-d \tan \left (e+f x+\frac {\pi }{2}\right )\right )^{n+2} \left (\tan \left (e+f x+\frac {\pi }{2}\right )^2+1\right )}{b-a \tan \left (e+f x+\frac {\pi }{2}\right )}dx}{a^2+b^2}-\frac {-\frac {b \left (a^2-b^2\right ) (d \cot (e+f x))^{n+3} \operatorname {Hypergeometric2F1}\left (1,\frac {n+3}{2},\frac {n+5}{2},-\cot ^2(e+f x)\right )}{f (n+3)}-\frac {2 a b^2 (d \cot (e+f x))^{n+4} \operatorname {Hypergeometric2F1}\left (1,\frac {n+4}{2},\frac {n+6}{2},-\cot ^2(e+f x)\right )}{d f (n+4)}}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 4117 |
\(\displaystyle \frac {\frac {-\frac {a^2 d \left (a^2 (n+2)+b^2 n\right ) \int \frac {(d \cot (e+f x))^{n+2}}{b+a \cot (e+f x)}d(-\cot (e+f x))}{f \left (a^2+b^2\right )}-\frac {-\frac {b \left (a^2-b^2\right ) (d \cot (e+f x))^{n+3} \operatorname {Hypergeometric2F1}\left (1,\frac {n+3}{2},\frac {n+5}{2},-\cot ^2(e+f x)\right )}{f (n+3)}-\frac {2 a b^2 (d \cot (e+f x))^{n+4} \operatorname {Hypergeometric2F1}\left (1,\frac {n+4}{2},\frac {n+6}{2},-\cot ^2(e+f x)\right )}{d f (n+4)}}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
\(\Big \downarrow \) 74 |
\(\displaystyle \frac {\frac {\frac {a^2 \left (a^2 (n+2)+b^2 n\right ) (d \cot (e+f x))^{n+3} \operatorname {Hypergeometric2F1}\left (1,n+3,n+4,-\frac {a \cot (e+f x)}{b}\right )}{b f (n+3) \left (a^2+b^2\right )}-\frac {-\frac {b \left (a^2-b^2\right ) (d \cot (e+f x))^{n+3} \operatorname {Hypergeometric2F1}\left (1,\frac {n+3}{2},\frac {n+5}{2},-\cot ^2(e+f x)\right )}{f (n+3)}-\frac {2 a b^2 (d \cot (e+f x))^{n+4} \operatorname {Hypergeometric2F1}\left (1,\frac {n+4}{2},\frac {n+6}{2},-\cot ^2(e+f x)\right )}{d f (n+4)}}{a^2+b^2}}{b d \left (a^2+b^2\right )}-\frac {a^2 (d \cot (e+f x))^{n+3}}{b d f \left (a^2+b^2\right ) (a \cot (e+f x)+b)}}{d^2}\) |
(-((a^2*(d*Cot[e + f*x])^(3 + n))/(b*(a^2 + b^2)*d*f*(b + a*Cot[e + f*x])) ) + ((a^2*(b^2*n + a^2*(2 + n))*(d*Cot[e + f*x])^(3 + n)*Hypergeometric2F1 [1, 3 + n, 4 + n, -((a*Cot[e + f*x])/b)])/(b*(a^2 + b^2)*f*(3 + n)) - (-(( b*(a^2 - b^2)*(d*Cot[e + f*x])^(3 + n)*Hypergeometric2F1[1, (3 + n)/2, (5 + n)/2, -Cot[e + f*x]^2])/(f*(3 + n))) - (2*a*b^2*(d*Cot[e + f*x])^(4 + n) *Hypergeometric2F1[1, (4 + n)/2, (6 + n)/2, -Cot[e + f*x]^2])/(d*f*(4 + n) ))/(a^2 + b^2))/(b*(a^2 + b^2)*d))/d^2
3.9.84.3.1 Defintions of rubi rules used
Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[c^n*((b*x )^(m + 1)/(b*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] && !IntegerQ[m] && (IntegerQ[n] || (GtQ[c, 0] && !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-d/(b*c), 0])))
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[a^p*(( c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/2, (m + 1)/2 + 1, ( -b)*(x^2/a)], x] /; FreeQ[{a, b, c, m, p}, x] && !IGtQ[p, 0] && (ILtQ[p, 0 ] || GtQ[a, 0])
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d Subst[Int [x^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{b, c, d, n}, x] && !IntegerQ[n]
Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x _)]), x_Symbol] :> Simp[c Int[(b*Tan[e + f*x])^m, x], x] + Simp[d/b Int [(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ[c^ 2 + d^2, 0] && !IntegerQ[2*m]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m + 1)*((c + d*Tan[e + f*x])^(n + 1)/(f*(m + 1)*(a^2 + b^2)*(b*c - a*d))), x] + Simp[1 /((m + 1)*(a^2 + b^2)*(b*c - a*d)) Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Simp[a*(b*c - a*d)*(m + 1) - b^2*d*(m + n + 2) - b*(b*c - a*d)*(m + 1)*Tan[e + f*x] - b^2*d*(m + n + 2)*Tan[e + f*x]^2, x], x], x] / ; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && LtQ[m, -1] && (LtQ[n, 0] || Integ erQ[m]) && !(ILtQ[n, -1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A/f Subst[Int[(a + b*x)^m*(c + d*x)^n, x], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, C, m, n}, x] && EqQ[A, C]
Int[(((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2))/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[1/(a^2 + b^2) Int[(c + d*Tan[e + f*x])^ n*Simp[b*B + a*(A - C) + (a*B - b*(A - C))*Tan[e + f*x], x], x], x] + Simp[ (A*b^2 - a*b*B + a^2*C)/(a^2 + b^2) Int[(c + d*Tan[e + f*x])^n*((1 + Tan[ e + f*x]^2)/(a + b*Tan[e + f*x])), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] & & !GtQ[n, 0] && !LeQ[n, -1]
Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x _)]^(n_.))^(p_.), x_Symbol] :> Simp[d^(n*p) Int[(d*Cot[e + f*x])^(m - n*p )*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x] && !IntegerQ[m] && IntegersQ[n, p]
\[\int \frac {\left (d \cot \left (f x +e \right )\right )^{n}}{\left (a +b \tan \left (f x +e \right )\right )^{2}}d x\]
\[ \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]
\[ \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int \frac {\left (d \cot {\left (e + f x \right )}\right )^{n}}{\left (a + b \tan {\left (e + f x \right )}\right )^{2}}\, dx \]
\[ \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]
\[ \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int { \frac {\left (d \cot \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]
Timed out. \[ \int \frac {(d \cot (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int \frac {{\left (d\,\mathrm {cot}\left (e+f\,x\right )\right )}^n}{{\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^2} \,d x \]